package com.ruoyi.system.util;

import java.time.Duration;
import java.time.LocalDateTime;

public class Car {

    private String licensePlate;
    private long enterTime;

    public Car(String licensePlate, long enterTime) {
        this.licensePlate = licensePlate;
        this.enterTime = enterTime;
    }
    public String getLicensePlate() {

        return licensePlate;

    }

    public long getEnterTime() {

        return enterTime;

    }


    private LocalDateTime entryTime;
    private LocalDateTime exitTime;

    // 其他车辆信息的属性和方法

    public int getDurationInMinutes() {
        return (int) Duration.between(entryTime, exitTime).toMinutes();
    }

    public void calculateFee(Car car) {
        int duration = car.getDurationInMinutes();
        int fee;

        if (duration <= 60) {
            fee = 10; // 停车不满1小时，收取10元
        } else {
            fee = 10 + (duration - 60) * 2; // 停车超过1小时，每分钟收取2元
        }

        // 其他计费规则的逻辑

        System.out.println("停车费用：" + fee + "元");
    }


    public boolean isDaytime(LocalDateTime time) {
        int hour = time.getHour();
        return hour >= 6 && hour < 22;
    }
}
